package com.hinnotek.amoeba.adapters.old

import android.view.View
import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.adapters.old.viewholder.ABaseViewHolder
import com.hinnotek.amoeba.bean.old.ProjectBean

class SellProjectRequirementListAdapter :
    BaseQuickAdapter<ProjectBean, ABaseViewHolder>(R.layout.item_sell_project_requirements_list) {
    override fun convert(holder: ABaseViewHolder, item: ProjectBean) {
        if (item.b == 0) {
            holder.setChecked(R.id.cb, false)
        } else {
            holder.setChecked(R.id.cb, true)
        }
        holder.getView<View>(R.id.cb).setOnClickListener { v ->
            val checkBox = v as CheckBox
            if (checkBox.isChecked) {
                item.b = 1
            } else {
                item.b = 0
            }
        }
    }
}